package com.yifeng.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

/**
 * Md5的加密封装
 * @author Administrator
 *
 */
public class Md5Util {

	public static final String SALT = "itsource_crm_0405";//盐值
	private static final int HASHITERATIONS = 10000;//加密次数

	/**
	 *
	 * 对content实现加密加盐操作
	 * @param content
	 * @return
	 */
	public static String encrypt(String content) {
		String algorithmName = "MD5";
		Object salt = ByteSource.Util.bytes(SALT);
		SimpleHash simpleHash = new SimpleHash(algorithmName , content, salt , HASHITERATIONS);
		return simpleHash.toString();
	}
}
